﻿<UserControl x:Class="Apps.Maps.MaplayerController"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <Style x:Key="angleThumbStyle1" TargetType="Thumb">
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Thumb">
                        <Grid Background="#00000000">
                            <Path x:Name="Path"
                                  VerticalAlignment="Bottom"
                                  HorizontalAlignment="Center"
                                  Margin="0,0,0,2"
                                  Width="7"
                                  Height="6"
                                  Stretch="Fill"
                                  Fill="#FF416972"
                                  Data="F1 M 1120,298.667L 1116,309.333L 1124,309.333L 1120,298.667 Z " />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="SliderStyle1" TargetType="Slider">
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Maximum" Value="10" />
            <Setter Property="Minimum" Value="0" />
            <Setter Property="Value" Value="0" />
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFA3AEB9" Offset="0" />
                        <GradientStop Color="#FF8399A9" Offset="0.375" />
                        <GradientStop Color="#FF718597" Offset="0.375" />
                        <GradientStop Color="#FF617584" Offset="1" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Slider">
                        <Grid x:Name="Root">
                            <Grid.Resources>
                                <ControlTemplate x:Key="RepeatButtonTemplate">
                                    <Grid x:Name="Root" Opacity="0" Background="Transparent" />
                                </ControlTemplate>
                            </Grid.Resources>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver" />
                                    <VisualState x:Name="Disabled"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid x:Name="HorizontalTemplate"
                                  Background="{TemplateBinding Background}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Rectangle x:Name="TrackRectangle"
                                           Fill="#FF416972"
                                           RadiusX="0"
                                           RadiusY="0"
                                           Height="1"
                                           Margin="5,0,5,0"
                                           Grid.Column="0"
                                           Grid.ColumnSpan="3" />
                                <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                              Height="18"
                                              IsTabStop="False"
                                              Template="{StaticResource RepeatButtonTemplate}"
                                              Grid.Column="0" />
                                <Thumb x:Name="HorizontalThumb"
                                       Height="18"
                                       Width="11"
                                       IsTabStop="True"
                                       Grid.Column="1"
                                       Style="{StaticResource angleThumbStyle1}" />
                                <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                              Height="18"
                                              IsTabStop="False"
                                              Template="{StaticResource RepeatButtonTemplate}"
                                              Grid.Column="2" />
                            </Grid>
                            <Grid x:Name="VerticalTemplate"
                                  Visibility="Collapsed"
                                  Background="{TemplateBinding Background}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Rectangle Fill="#FF828483"
                                           RadiusX="0"
                                           RadiusY="0"
                                           Margin="0,5,0,5"
                                           Width="1"
                                           Grid.Row="0"
                                           Grid.RowSpan="3" />
                                <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                              Width="18"
                                              IsTabStop="False"
                                              Template="{StaticResource RepeatButtonTemplate}"
                                              Grid.Row="2" />
                                <Thumb x:Name="VerticalThumb"
                                       Height="11"
                                       Width="18"
                                       IsTabStop="True"
                                       Grid.Row="1"
                                       Style="{StaticResource angleThumbStyle1}" />
                                <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                              Width="18"
                                              IsTabStop="False"
                                              Template="{StaticResource RepeatButtonTemplate}"
                                              Grid.Row="0" />
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.RenderTransform>
            <CompositeTransform/>
        </Grid.RenderTransform>
        <!--<toolKit:ListBoxDragDropTarget AllowDrop="True">-->
        <ListBox x:Name="listView" BorderBrush="Transparent" Background="Transparent">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid DataContext="{Binding}">
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Rectangle Grid.ColumnSpan="2" Fill="{StaticResource ToolbarTopBrush}" Margin="2,1" Grid.RowSpan="2" Stroke="Black"/>
                                    <TextBlock Text="{Binding ID}" Grid.ColumnSpan="2" Margin="5,2,0,0"
                                               Style="{StaticResource DefaultTextBlock}"/>
                                    <CheckBox Grid.Row="1" IsChecked="{Binding Visible, Mode=TwoWay}" Margin="5,2,0,2"/>
                                    <Slider Grid.Row="1" Grid.Column="1"
                                            Style="{StaticResource SliderStyle1}"
                                            LargeChange="0.1" Maximum="1" Minimum="0" Cursor="Hand" 
                                            Value="{Binding Opacity, Mode=TwoWay}" Margin="5,0,5,3" Width="150"/>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
    </Grid>
</UserControl>
